<?php

	error_reporting(0);
	Workerman\Protocols\Http::sessionStart();

	define('IN_IA', true);
	define("IA_ROOT_WEB", $_SESSION['IA_ROOT_WEB']);
	
	ini_set('display_errors', 'on');
	
	require_once IA_ROOT_WEB . '/include/function/common.func.php';
	require_once IA_ROOT_WEB . '/include/function/pdo.func.php';

	Workerman\Protocols\Http::header("Content-type: text/css; charset=utf-8");

	$user_groups = $_SESSION["user_groups"];
	$sql = "select authority from hf_mes_groups where id='$user_groups'";
	$ret = pdo_fetchall($sql);
	//print_r(json_decode(current($ret)['authority'],true));
	$group = json_decode(current($ret)['authority'],true);
	$class_array = array();
	//获取所有的classname
	foreach ($group as $k => $v) {	
	
		$classname = substr($k,strpos($k,"_")+1,strrpos($k,"_")-strlen($k));

		if(!in_array($classname,$class_array)){

			array_push($class_array, $classname);

		}
		
	}
	
?>


<?php 

	foreach ($class_array as $value) {

		foreach ($group as $k => $v) { 
			
			if($v == 1 && strstr($k,$value)){
					if(strstr($k,'004') || strstr($k,'005') || strstr($k,'006')){ ?>
						.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:inline-block !important;}
						.mod_menu_btn_<?php echo $value; ?>_<?php echo $k; ?>{display:block !important;}
				<?php }elseif(strstr($k,'007') || strstr($k,'008') || strstr($k,'009')){ ?>
					.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:inline-block !important;}
				<?php }else{?>
					.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:block !important;}
					.mod_menu_btn_<?php echo $value; ?>_<?php echo $k; ?>{display:block !important;}
				<?php } ?>

			<?php }elseif($v == "" && strstr($k,$value)){?>
				
				.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:none !important;}
				.mod_menu_btn_<?php echo $value; ?>_<?php echo $k; ?>{display:none !important;}
			<?php }






			/*if($v ==1 && strstr($k,$value) && strstr($k,'004') || strstr($k,'005') || strstr($k,'006')){ ?>
		
				
			
			<?php }elseif($v ==1 && strstr($k,'007') || strstr($k,'008') || strstr($k,'009')){ ?>
				<?php var_dump($v);?>
				.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:inline-block !important;}


			<?php }elseif($v ==1 && strstr($k,$value)){ ?>
		
				.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:block !important;}
				.mod_menu_btn_<?php echo $value; ?>_<?php echo $k; ?>{display:block !important;}
				
			<?php }elseif($v =='' && strstr($k,$value)){ ?>
				
				.mod_<?php echo $value; ?> .mod_btn_<?php echo $value; ?>.<?php echo $k; ?>{display:none !important;}
				.mod_menu_btn_<?php echo $value; ?>_<?php echo $k; ?>{display:none !important;}

		<?php }*/
		}
	}
?>


/*
.mod_user .mod_btn_user.cps_user_001{display:none !important;}
.mod_menu_btn_user_cps_user_001{display:none !important;}
*/